from Net import Net
from MCTS import MCTS
from Board import Board

net = Net('./model/policy_loss2.1991634.model')
board = Board(1, 0)
mcts = MCTS(net, board)
if board.current_player==1:
    print("红方是电脑")
else:
    print("红方是玩家")
while 1:
    board.not_end()
    if not board.not_end_number:
        break
    if board.current_player:
        board.next_move = mcts.get_move()  # 格式 xyab
        print("电脑位置",board.next_move)
    else:
        board.next_move = int(input('请输入下一步棋，格式xy ab: '))  # 输入格式 xyab
        board.find_move()
        if board.next_move not in board.valid_move:
            print("输入位置错误")
            continue
    board.all_move.append(board.next_move)
    board.move()
    mcts.board = board
    mcts.update_with_move()